POV-Ray : Newsgroups : povray.general : Is it possible to have optional arguments in macros. : Is it possible to have optional arguments in macros. Server Time
30 Jul 2024 22:27:17 EDT (-0400)
  Is it possible to have optional arguments in macros.  
From: Bridgeofstraws
Date: 29 Apr 2008 07:05:01
Message: <web.4816ffbf42eefae121397d5a0@news.povray.org>
Hello everyone,

I was wondering if it is possible to develop a way so that the M22 object may
not necessarily need all 4 textures.  Whether it be by making optional macros
or special if statements that compare textures (because I could make a null
texture).  Thank you for you time and help!

The code of my macros is below.

#macro M22 (BodyTexture1, BodyTexture2, ConeTexture, ImperfectionTexture)
        object{
                union{
                        #switch(CSGOrIsosurface)
                                #case(1)
                                        object{CSGM22Chassis
                                        texture {BodyTexture1}
                                        texture {BodyTexture2}
                                        texture {ConeTexture} //This is used
with any texture to create a different coloured cone for the plane
                                        texture {ImperfectionTexture}
                                        translate z*15}
                                #break
                                //--OR--
                                #case(2)
                                        object{MeshM22Chassis
                                        //the next 2 lines, adjust for blenders
exporter
                                        translate z*-1.5
                                        scale 10
                                        //
                                        texture {BodyTexture1}
                                        texture {BodyTexture2}
                                        texture {ConeTexture} //This is used
with any texture to create a different coloured cone for the plane
                                        texture {ImperfectionTexture}
                                        translate z*15
                                        }
                                #break
                                //--OR--
                                #case(3)
                                        object{IsoM22Chassis
                                        texture {BodyTexture1}
                                        texture {BodyTexture2}
                                        texture {ConeTexture} //This is used
with any texture to create a different coloured cone for the plane
                                        texture {ImperfectionTexture}
                                        translate z*15}
                                #break
                        #end

                        object{Cockpit interior{ior 1.3}}
                        scale 1/2  //make this plane a realistic size
                        //add any weapons here

                }

        }
        #end


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.